3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Figure 12 shows a mesh.
Int nFaceVertexIndices
Uns faceVertexIndices[|nFaceVertexIndices|]
The mesh face data type is used to specify a vertexed object and to specify whether that object is a face or a contour of a mesh. This data type occurs only as the value of a field in the faces[] array of a mesh specification.
Uns32 nVertices
Vertex3D vertices[nVertices]
Uns32 nFaces
Uns32 nContours
MeshFace faces[nFaces + nContours]
sizeof(MeshFace) = fabs(Int) * 4
sizeof(Mesh) = 4 + nVertices * 12 + 8 + sizeof(faces[0...nFaces+nContours-1])
A mesh is an object defined by a collection of vertices, faces, and contours. Meshes may be used to model polyhedra, grids, and other faceted objects. A mesh may have a boundary. The term contour is used here to refer to a polygonal hole contained in a single face of a mesh. A mesh face (or contour) is a list of vertices that defines a polygonal facet. A face (or contour) need not be planar, and a contour and its surrounding face need not be coplanar; however, rendering of a mesh having a nonplanar face or contour, or having a contour not coplanar with its surrounding face, may lead to unexpected results.
The specification of a mesh includes an array of vertices and an array of faces and contours. The vertices of a mesh are indexed by array position; these indices are used to specify the faces and contours of that mesh. Faces and contours are also indexed by array position; this index does not distinguish between faces and contours. Both of these indices are used in the specification of child objects.
Attributes may be attached separately and selectively to the vertices, faces, face edges, and corners of a mesh.
Face attribute set list (optional), vertex attribute set list (optional), mesh corners (optional), mesh edges (optional). See "Mesh Corners" , and "Mesh Edges" , for descriptions of these objects.
Mesh (
10 # nVertices
-1 1 1 # enumeration of vertices
-1 1 -1
1 1 -1
1 -1 -1
1 -1 1
0 -1 1
-1 -1 0
-1 -1 -1
1 1 1
-1 0 1
7 # nFaces
0 # nContours
3 6 5 9 # enumeration of contours
5 7 6 9 0 1
4 2 3 7 1
4 2 8 4 3
4 1 0 8 2
5 4 8 0 9 5
5 3 4 5 6 7
)
Previous | QD3D Book | Overview | Chapter Contents | Next |